import fetch from '../../utils/fetch'

Page({
  data:{
    imgList:[],
    categoryList:[]
  },
  onShow(){
    this.getImgList()
    this.getCategoryList()
  },
  // 获取轮播图
  getImgList(){
    fetch({
      url:'slides'
    }).then(res => {
      this.data.imgList = res.data
      this.setData(this.data)
    })
  },
  getCategoryList(){
    fetch({
      url:'categories'
    }).then(res => {
      this.data.categoryList = res.data
      this.setData(this.data)
    })
  }

})